---
description: "Reference for Nitric's v0 Go library - Get an upload URL for a file from a bucket."
---

# Go - Bucket.File.UploadUrl()

Create an upload URL for a file within a bucket.

```go
import (
  "context"
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketWriting)
  if err != nil {
    return
  }

  uploadUrl, err := bucket.File("cat.png").UploadUrl(context.TODO(), 600)
  if err != nil {
    return
  }

  nitric.Run()
}
```

## Parameters

<Properties>
  <Property name="ctx" required type="context">
    The context of the call, used for tracing.
  </Property>
  <Property name="expiry" required type="int">
    Seconds until link expiry. Maximum of `604800` (7 days).
  </Property>
</Properties>

## Examples

### Create a temporary file upload link for a user

```go
import (
  "context"
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  bucket, err := nitric.NewBucket("bucket-name").With(nitric.BucketWriting)
  if err != nil {
    return
  }

  uploadUrl, err := bucket.File("cat.png").UploadUrl(context.TODO(), 600)
  if err != nil {
    return
  }

  nitric.Run()
}
```
